Skip to content

Conversation

ludvigz
Copy link
Member

@ludvigz ludvigz commented Nov 13, 2026

Purpose

The PC builder loaded saved builds from localStorage without validating them, treated missing component prices as zero without telling the user, and showed several unnecessary "Unknown" compatibility messages for an empty build. This PR makes the builder more reliable and clearer in those cases.

Changes

  • Validate each saved part before loading it. A part is kept only if its category matches the key it is saved under, it has a string id and name, its price is null or a non-negative number, and details is an object. Invalid parts are dropped and valid ones are kept. Broken JSON and values that are not an object still give an empty build, without crashing.
  • Show "Incomplete total: N selected components have no price." under the build total when any selected component has no price. Slots for such components now say "Price unavailable" instead of a bare "€".
  • Show a single message, "Add components to your build to check compatibility.", when no components are selected, instead of eight "Unknown" lines. Once any component is selected the normal compatibility panel, including warnings and incompatibilities, is shown as before.
  • Update BuildProvider.test.tsx for the full part shape and the new validation.

Related issues

Closes #99

Verification

(frontend):

  • npm test: all 89 tests pass.

Manual testing (steps to run in the browser):

  1. With an empty build, the compatibility panel shows only the single message. With parts selected, the groups and any incompatibilities show as before.
  2. Set one saved part's price_eur to null in localStorage and reload: the summary shows the incomplete-total note and the slot shows "Price unavailable".

Screenshots

image

Checklist

  • I have reviewed my own changes.
  • The changes meet the linked issue's acceptance criteria, where applicable.
  • I have verified the changes and recorded the results above.
  • I have added or updated tests where needed.
  • I have updated documentation where needed.
  • I have included screenshots for visual changes, or marked them not applicable.

@ludvigz ludvigz requested a review from a team as a code owner November 13, 2026 20:20
@ludvigz ludvigz self-assigned this Nov 13, 2026
@ludvigz ludvigz linked an issue Nov 13, 2026 that may be closed by this pull request
5 tasks
Copy link
Member

@oscarog oscarog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@oscarog oscarog merged commit a393545 into dev Nov 13, 2026
@oscarog oscarog deleted the 99-improve-pc-builder-reliability-and-user-feedback branch November 13, 2026 22:12
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve PC builder reliability and user feedback
2 participants